﻿<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="Microsoft.Help.SelfBranded" content="true" />
    <meta name="Language" content="en-us" />
    <meta name="Microsoft.Help.Locale" content="en-us" />
    <meta name="Microsoft.Help.TopicLocale" content="en-us" />
    <link rel="shortcut icon" href="../icons/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="../styles/branding.css" />
    <link rel="stylesheet" type="text/css" href="../styles/branding-en-US.css" />
    <script type="text/javascript" src="../scripts/branding.js"></script>
    <title>SosoObject.CompareTo(Object) Method</title>
    <meta name="Title" content="CompareTo(Object) Method" />
    <meta name="Microsoft.Help.Id" content="M:SosoMS.Common.SosoObject.CompareTo(System.Object)" />
    <meta name="Microsoft.Help.ContentType" content="Reference" />
    <meta name="container" content="SosoMS.Common" />
    <meta name="file" content="3f32c55a-3d6c-f9f6-e197-6da498dd5478" />
    <meta name="guid" content="3f32c55a-3d6c-f9f6-e197-6da498dd5478" />
    <meta name="Description" content="Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object." />
    <link rel="stylesheet" type="text/css" href="../styles/branding-Help1.css" />
  </head>
  <body onload="SetDefaultLanguage('cs');">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <div id="PageHeader" class="pageHeader">嗖嗖常用方法帮助集</div>
    <div class="pageBody">
      <div id="TopicContent" class="topicContent">
        <table class="titleTable">
          <tr>
            <td class="titleColumn">
              <h1>Soso<wbr />Object<span id="LSTA9996870_0" data-languageSpecificText="cpp=::|nu=."></span>Compare<wbr />To(Object) Method</h1>
            </td>
          </tr>
        </table>
        <div class="summary">Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.</div>
        <br />
        <strong>Namespace:</strong> <a href="2a09b3c0-4db5-f6fd-af61-86e07091f341.htm">SosoMS.Common</a><br /><strong>Assembly:</strong> SosoMS.Common (in SosoMS.Common.dll) Version: 1.0.0<div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('IDB')" onkeypress="SectionExpandCollapse_CheckKey('IDB', event)" tabindex="0"><img id="IDBToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />Syntax</span></div><div id="IDBSection" class="collapsibleSection"><div id="IDAB" class="codeSnippetContainer"><div class="codeSnippetContainerTabs"><div id="IDAB_tab1" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','cs','1','4');return false;">C#</a></div><div id="IDAB_tab2" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','vb','2','4');return false;">VB</a></div><div id="IDAB_tab3" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','cpp','3','4');return false;">C++</a></div><div id="IDAB_tab4" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','fs','4','4');return false;">F#</a></div></div><div class="codeSnippetContainerCodeContainer"><div class="codeSnippetToolBar"><div class="codeSnippetToolBarText"><a id="IDAB_copyCode" href="#" class="copyCodeSnippet" onclick="CopyToClipboard('IDAB');return false;" title="Copy">Copy</a></div></div><div id="IDAB_code_Div1" class="codeSnippetContainerCode" style="display: block"><pre xml:space="preserve"><span class="keyword">public</span> <span class="identifier">int</span> <span class="identifier">CompareTo</span>(
	<span class="identifier">Object</span>? <span class="parameter">obj</span>
)</pre></div><div id="IDAB_code_Div2" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">Public</span> <span class="keyword">Function</span> <span class="identifier">CompareTo</span> ( 
	<span class="parameter">obj</span> <span class="keyword">As</span> <span class="identifier">Object</span>
) <span class="keyword">As</span> <span class="identifier">Integer</span></pre></div><div id="IDAB_code_Div3" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">public</span>:
<span class="keyword">virtual</span> <span class="identifier">int</span> <span class="identifier">CompareTo</span>(
	<span class="identifier">Object</span>^ <span class="parameter">obj</span>
) <span class="keyword">sealed</span></pre></div><div id="IDAB_code_Div4" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">abstract</span> <span class="identifier">CompareTo</span> : 
        <span class="parameter">obj</span> : <span class="identifier">Object</span> <span class="keyword">-&gt;</span> <span class="identifier">int</span> 
<span class="keyword">override</span> <span class="identifier">CompareTo</span> : 
        <span class="parameter">obj</span> : <span class="identifier">Object</span> <span class="keyword">-&gt;</span> <span class="identifier">int</span> </pre></div></div></div><h4>Parameters</h4><dl><dt class="has-text-weight-normal"><span class="parameter">obj</span>  <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a></dt><dd>An object to compare with this instance.</dd></dl><h4>Return Value</h4><a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a><br />A value that indicates the relative order of the objects being compared. The return value has these meanings:  
  
 <table><thead><tr><th> Value</th><th> Meaning</th></tr></thead><tr><td> Less than zero</td><td> This instance precedes <span class="parameter">obj</span> in the sort order.</td></tr><tr><td> Zero</td><td> This instance occurs in the same position in the sort order as <span class="parameter">obj</span>.</td></tr><tr><td> Greater than zero</td><td> This instance follows <span class="parameter">obj</span> in the sort order.</td></tr></table><h4>Implements</h4><a href="https://learn.microsoft.com/dotnet/api/system.icomparable.compareto#system-icomparable-compareto(system-object)" target="_blank" rel="noopener noreferrer">IComparable<span id="LSTA9996870_1" data-languageSpecificText="cs=.|vb=.|cpp=::|nu=.|fs=."></span>CompareTo(Object)</a><br /></div><div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('IDAC')" onkeypress="SectionExpandCollapse_CheckKey('IDAC', event)" tabindex="0"><img id="IDACToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />Exceptions</span></div><div id="IDACSection" class="collapsibleSection"><table><tr><th>Exception</th><th>Condition</th></tr><tr><td><a href="https://learn.microsoft.com/dotnet/api/system.nullreferenceexception" target="_blank" rel="noopener noreferrer">NullReferenceException</a></td><td>This instance is null</td></tr><tr><td><a href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception" target="_blank" rel="noopener noreferrer">ArgumentNullException</a></td><td>The other is null</td></tr><tr><td><a href="https://learn.microsoft.com/dotnet/api/system.argumentexception" target="_blank" rel="noopener noreferrer">ArgumentException</a></td><td><span class="parameter">obj</span> is not the same type as this instance.</td></tr></table></div><div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('seeAlso')" onkeypress="SectionExpandCollapse_CheckKey('seeAlso', event)" tabindex="0"><img id="seeAlsoToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />See Also</span></div><div id="seeAlsoSection" class="collapsibleSection"><h4>Reference</h4><div><a href="20e9649d-e4bc-866f-da03-1debaac644b2.htm">SosoObject Class</a></div><div><a href="a62ea7ab-865f-711d-4e5e-6cbc5a950826.htm">CompareTo Overload</a></div><div><a href="2a09b3c0-4db5-f6fd-af61-86e07091f341.htm">SosoMS.Common Namespace</a></div></div></div>
    </div>
    <div id="PageFooter" class="pageFooter" />
  </body>
</html>